package com.panopset.gui;

import java.math.BigDecimal;

/**
 * Integer properties file value editor.
 *
 * @author Karl Dinwiddie
 * @deprecated
 *
 */
public class PropvalEditorBigDecimal extends PropvalEditor {

    /**
     * @return BigDecimal value.
     * @throws Exception Exception.
     */
    public BigDecimal getBigDecimal() throws Exception {
        return getBD(getValue());
    }

    private BigDecimal getBD(final String s) throws Exception {
        return new BigDecimal(s);
    }

    /**
     * @param propertiesFileName
     *            Properties file name.
     */
    public PropvalEditorBigDecimal(final String propertiesFileName) {
        this(null, propertiesFileName);
        if (true) {
            throw new RuntimeException();
        }
    }

    /**
     * @param defaultResourcePath
     *            Default resource path.
     * @param propertiesFileName
     *            Properties file name.
     */
    public PropvalEditorBigDecimal(final String defaultResourcePath,
            final String propertiesFileName) {
        super(defaultResourcePath, propertiesFileName);
    }

    @Override
    protected final boolean validate(final String s) {
        try {
            String compare = "" + getBD(s);
            return (compare).equals(s);
        } catch(Exception ex) {
            return false;
        }
    }

}
